
 import Vue from 'vue'
Vue.filter('phone', function (value) {
    if (!value) return '';
    let str = value;
    str = str.toString().replace(/^(\d{3})(\d{4})(\d{4})/g , '$1****$3')
    return str;
  })
  
  Vue.filter('credentialsNum', function (value) {
    if (!value) return '';
    let str = value;
    str = str.toString().replace(/^(.{6})(?:\d+)(.{4})$/, "$1****$2")
    return str;
  })
  

  /**
   * 匹配名字
   * 王仙女 => 王*女
   */
  
  Vue.filter('name', function (value) {
    if (!value) return '';
    let str = value;
    str = str.toString().replace(/^([^\x00-\xff])([^\x00-\xff]{0,})([^\x00-\xff])/g , '$1*$3')
    return str;
  })
  export default {
    init () {
      console.log('*** filter installed ***')
    }
  }
